package cloud.estate.complaint.Controller;

import cloud.estate.commons.bean.Complaint;
import cloud.estate.commons.util.JsonResult;
import cloud.estate.complaint.service.ComplaintService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/complaint")
public class ComplaintController {
    @Resource
    private ComplaintService complaintService;
    @PostMapping("/addOneComplaint")
    public JsonResult addOneComplaint(Complaint complaint)
    {
        return complaintService.addOneComplaint(complaint);
    }
    @PostMapping("/deleteOneComplaint")
    public JsonResult deleteOneComplaint(String id){
        return complaintService.deleteOneComplaint(id);
    }
    @PostMapping("/updateOneComplaint")
    public JsonResult updateOneComplaint(Complaint complaint){
        return complaintService.updateOneComplaint(complaint);
    }
    @GetMapping("/getOneComplaint")
    public JsonResult getOneComplaint(String id){
        return complaintService.getOneComplaint(id);
    }
    @GetMapping("/listAllComplaint")
    public JsonResult listAllComplaint(){
        return complaintService.listAllComplaint();
    }
}
